#include <QCoreApplication>
#include <QLocale>
#include <QDebug>

#include "TranslationLanguage.h"

//----------------------------------------------------------------------------------------
TranslationLanguage::TranslationLanguage() {
    translationDir = QCoreApplication::applicationFilePath();
    //setLocaleForApplication();
}

//----------------------------------------------------------------------------------------
void TranslationLanguage::setTranslationDir(const QString &dir) {
    translationDir = dir;
}

//----------------------------------------------------------------------------------------
void TranslationLanguage::setTranslationFile(const QString &file) {
    fileTranslation = file;
}

//----------------------------------------------------------------------------------------
void TranslationLanguage::setLocaleForApplication() {
//    QString locale = QLocale::system().name();
    translator.load(translationDir + QString(fileTranslation));
}

//----------------------------------------------------------------------------------------
void TranslationLanguage::setEngLocale() {
    translator.load(translationDir + "/" + "empty");
}

//----------------------------------------------------------------------------------------
void TranslationLanguage::setRusLocale() {
    translator.load(translationDir + "/" + "translate_ru");
}

//----------------------------------------------------------------------------------------
QTranslator* TranslationLanguage::getTranslator() {
    return &translator;
}

//----------------------------------------------------------------------------------------
